<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>旋转立方体</title>
        <style>
            *{
                margin: 0;
                padding: 0;
            }
            body,html{
                height: 100%;
            }
            div{
                width: 600px;
                height: 500px;
                border: 2px solid peru;
                position: absolute;
                left: 50%;
                margin-left: -300px;
                top: 50%;
                margin-top: -250px;
            }
            ul{
                width: 200px;
                height: 200px;
                position: absolute;
                top: 0;left: 0;
                right: 0;bottom: 0;
                margin: auto;
                transform-style: preserve-3d;
                animation: box 4s infinite linear;
            }
            @keyframes box {
                from{
                    transform: rotate3d(0,0,0,0deg);
                }
                to{
                    transform: rotate3d(1,1,1,360deg);
                }
            }
            li{
                width: 200px;
                height: 200px;
                list-style: none;
                line-height: 200px;
                font-size: 30px;
                font-weight: bold;
                text-align: center;
                position: absolute;
                top: 0;
            }
            li:nth-of-type(1){
                background: yellow;
                transform: translate3d(0,0,100px);
            }
            li:nth-of-type(2){
                background: orchid;
                transform: translate3d(-100px,0,0) rotate3d(0,1,0,-90deg);
            }
            li:nth-of-type(3){
                background: green;
                transform: translate3d(100px,0,0) rotate3d(0,1,0,90deg);
            }
            li:nth-of-type(4){
                background: pink;
                transform: translate3d(0,-100px,0) rotate3d(1,0,0,90deg);
            }
            li:nth-of-type(5){
                background: red;
                transform: translate3d(0,100px,0) rotate3d(1,0,0,-90deg);
            }
            li:nth-of-type(6){
                background: blue;
                transform: translate3d(0,0,-100px) rotate3d(0,1,0,180deg);
            }
            p{
                width: 50px;
                height: 20px;
                margin-top: 10px;
                background: palegreen;
            }
        </style>
    </head>
    <body>
        <div>
            <ul>
                <li>1</li>
                <li>2</li>
                <li>3</li>
                <li>4</li>
                <li>5</li>
                <li>6</li>
            </ul>
        </div>
    </body>
</html>